<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script>
        var xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function () {
            if (xhr.readyState == 4) {
                if ((xhr.status >= 200 && xhr.status < 300) || xhr.status == 304) {
                    alert(encodeURIComponent(xhr.responseText));
                    alert(xhr.statusText)
                } else {
                    alert('error')
                }
            }
        }
        xhr.open('get', 'dome.txt');
        xhr.send(null);
    </script>
</body>
</html>
